import React, { useState } from "react";
import ContextKaho from "./index";

export const MyContext = React.createContext("");

export default function ComponentContext() {
  const [name, setName] = useState("kaho");

  return (
    <div>
      <MyContext.Provider value={name}>
        <MyContext.Consumer>
          {(ctx) => (
            <div>
              <ContextKaho name={ctx} />
            </div>
          )}
        </MyContext.Consumer>
      </MyContext.Provider>
      <button onClick={() => setName("kahoohak")}>setName</button>
    </div>
  );
}
